package cate.game.pvp.ladder.msg;

import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgOutput;
import cate.game.client.msg.id.MsgIdBLadder;
import cate.game.pvp.ladder.common.LadderOppoSnapshot;
import cate.game.role.Role;
import cate.game.role.farm.PlayTimes;
import cate.game.pvp.ladder.RoleLadder;
import easy.java.dev.note.NoteField;
import lombok.Data;

import java.util.List;

@Data
@ClientMsg(title = "天梯赛 个人数据 の 返回")
public class LadderDataResp implements MsgOutput {

    @NoteField("挑战次数")
    public PlayTimes playTimes;

    @NoteField("当前排名")
    public int rank;

    @NoteField("最近刷新时间")
    public long recentRefreshTime;

    @NoteField("当前刷新出来的对手列表")
    public List<LadderOppoSnapshot> opponents;

    @Override
    public MsgConfig conf() {
        return MsgIdBLadder.DATA_RESP;
    }

    public static void doSend(Role role) {
        LadderDataResp resp = new LadderDataResp();
        RoleLadder ladder = role.getPvp().ladder;
        resp.playTimes = ladder.playTimes;
        resp.rank = ladder.rank;
        resp.recentRefreshTime = ladder.recentRefreshTime;
        resp.opponents = ladder.opponents;
        resp.sendNow(role);
    }
}
